const { toCssVal, typeOf } = require("utils/index");
const baseSrc = "../../assets/img/local/avatar.png";

Component({
  options: {
    styleIsolation: "apply-shared",
  },
  properties: {
    mode: {
      type: String,
      value: "aspectFill",
      validator(val) {
        return [
          "scaleToFill",
          "aspectFit",
          "aspectFill",
          "widthFix",
          "heightFix",
          "center",
        ].includes(val);
      },
    },
    to: {
      type: String,
      value: "",
    },
    src: {
      type: String,
      value: "",
    },
    size: {
      type: String,
      value: "120",
    },
    isVip: {
      type: Boolean,
      value: false,
    },
  },

  data: {
    baseSrc,
    style: "",
  },
  attached() {
    let { size } = this.data;
    size = toCssVal(size);
    this.setData({
      style: `height:${size}; width:${size};border-radius: 50%;`,
    });
  },
  methods: {},
});
